package com.homework_9_1;

public class Biz implements UserBiz {
    User user1=new User("admin "  ,"123456 " , "张三"  ,   "admin@123.com");
    User user2=new User("tom "  ,  "123456"  , "李四",   "  tomcat@cat.com");
    private User[] user={user1,user2};
    public void register(String username, String password, String rePassword,
                         String name, String email)throws IllegalRegisterException{
            if (username.equals(user1.getUsername())||username.equals(user2.getUsername())||password!=rePassword){
                throw new IllegalRegisterException("用户名已存在或两次密码输入不一致");
            }

    }
    public   void login(String username, String password) throws IllegalLoginException{
        if (!username.equals(user1.getUsername())||!username.equals(user2.getUsername())){
            throw new IllegalLoginException("用户名不存在或用户名与密码不一致");
        }
    }

    public Biz(User[] user) {
        this.user = user;
    }

    public Biz() {

    }
}
